<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Search By Customer Birthday</title>
  </head>
  <body>
    <div id='searchByBirthday'>
    </div>
    <script>
        Ext.onReady(function(){
            var birthdayKey = new Ext.form.DateField({
                fieldLabel: '选择生日',
                name: 'birthdayKey',
                format: 'Y-m-d', //格式化日期   
                width: '200',
                //disabledDays: [0,6],	//不让选择周六，周日   
                //disabledDaysText: "周末要休息",   
                invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                allowBlank: true,
                inputType: '2008-01-01',
                anchor: '90%',
                listeners: {
                    select: function(field, e){
                        Ext.MessageBox.alert('提示', '提交成功');
                    }
                }//,
                //onTriggerClick:function(){Ext.MessageBox.alert('提示', '提交成功');}
                //value:'1975-01-01'
                //maxValue:'1925-01-01'
            });
            var searchButton = new Ext.Button({
                text: '搜 索',
                handler: searchByBirday
            })
            var formPanel = new Ext.form.FormPanel({
                //baseCls: 'x-plain',
                labelWidth: 75,
                width: '300',
                labelAlign: 'right',
                frame: true,
                //url: '/admin/addAirways',
                //defaultType: 'textfield',
                items: [{
                        layout: 'column',
                        border: false,
                        items: [{
                                columnWidth: .7,
                                layout: 'form',
                                border: false,
                                items: [birthdayKey]
                            }, {
                                columnWidth: .3,
                                layout: 'form',
                                border: false,
                                items: [searchButton]
                            }]
                    }]
            });
            formPanel.render('searchByBirthday');
            function searchByBirday(){
                if (birthdayKey.getValue() != "") {
                    selectedDate = Ext.util.Format.date(birthdayKey.getValue(), 'Y-m-d');
                    customerDS.baseParams.birthdayKey = selectedDate;
                    customerDS.load({
                        params: {
                            start: 0,
                            limit: 10
                        }
                    });
                    customerDS.baseParams.birthdayKey=null;
                }
            }
        });
    </script>
  </body>
</html>
